<template>
    <div class="submitBtn" style="z-index:9999;">
        <a @click="SubmitAnswer(true)">提交答案</a>
    </div>
</template>
<script>
export default {
    name: 'stSubmitBtn',
    props: ["ResourceID"],
    data() {
        return {
        }
    },
    methods: {
      SubmitAnswer(isSubmit){
        isSubmit = typeof(isSubmit) == 'boolean' ? isSubmit : false
        var _this=this, layerIndex = layer.confirm('您确定要提交答案吗？', {
                btn: ['确定','取消'] //按钮
            }, function(){
                layer.close(layerIndex)
                var _aed=[];
                for(var i in window.Test){
                    for(var j in window.Test[i]){
                        _aed.push(window.Test[i][j])
                    }
                }
                window.ExamSubmit.EndPiont=parseInt((new Date().getTime() - (parseFloat(window.ExamSubmit.BeginTeachingTime) - 621356256000000000) / 10000) / 60000)
                window.ExamSubmit.TimeInterval = parseInt((new Date().getTime()-window.ExamSubmit.dt)/1000/60)
                window.ExamSubmit.IsSubmit = isSubmit
                var xxx={ es: JSON.stringify(window.ExamSubmit), ed: JSON.stringify(_aed) }
                console.log(xxx)
               console.log(JSON.stringify(xxx))
                $.post(window.baseURL+'api/ReTest/SaveExamResult?sk='+_this.$store.state.token,xxx,function(rtn){
                    if(rtn.state==200){
                        _this.$router.push('/main')
                    }else{
                        layer.msg(rtn.message)
                    }
                },'json')
            }, function(){
                layer.msg('你取消了');
        });
      }
    }
}
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
@-webkit-keyframes greenPulse {
	from {
		background-color:#749a02;
		-webkit-box-shadow:0 0 9px #333;
	}
	50% {
		background-color:#91bd09;
		-webkit-box-shadow:0 0 18px #91bd09;
	}
	to {
		background-color:#749a02;
		-webkit-box-shadow:0 0 9px #333;
	}
}
.submitBtn {
    padding-top: 0.8125em;
    padding-bottom: 0.75em;
    -webkit-appearance: none;
}
.submitBtn {
    border-style: solid;
    border-width: 0;
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
    line-height: normal;
    margin: 0 0 1.25em;
    position: relative;
    text-decoration: none;
    text-align: center;
    display: inline-block;
    padding-top: 0.75em;
    padding-right: 1.5em;
    padding-bottom: 0.8125em;
    padding-left: 1.5em;
    font-size: 1em;
    background-color: #adc708;
    border-color: #829606;
    color: white;
	box-shadow: 0 -2px 0 rgba(0,0,0,0.2) inset;
	-webkit-animation-iteration-count: infinite;
	-webkit-animation-name: greenPulse;
	-webkit-animation-duration: 3s;
	position:fixed;
	top:8%;
	right:1%;
}
</style>